import { defineStore } from "pinia";

export const useCountStore = defineStore("useCountStore", {
  state() {
    return {
      storesum: 100 as number,
      adress: localStorage.getItem("dataSelf") || "",
    };
  },
  getters: {
    bigStoresum: (state) => state.storesum + "~", //箭头函数 不用this
    smalleStoresum(): any {
      return this.storesum + "-"; // 使用this
    },
  },
  actions: {
    increment(n: any) {
      console.log("调用action了", n, this.storesum);
      this.storesum += n;
    },
    downce(n: any) {
      this.storesum -= n;
    },
  },
});
